Skip to content

Instantly share code, notes, and snippets.

class Player {
constructor(level = 1, currentXP = 0, totalXP = 0, xpForNextLevel = 100, xpGrowthRate = 1.5) {
this.level = level;
this.currentXP = currentXP;
this.totalXP = totalXP;
this.xpForNextLevel = xpForNextLevel;
this.xpGrowthRate = xpGrowthRate;
}
addXP(amount) {
-- Define the Player class
Player = {}
Player.__index = Player
-- Constructor
function Player:new(level, currentXP, totalXP, xpForNextLevel, xpGrowthRate)
local obj = {
level = level or 1,
currentXP = currentXP or 0,
totalXP = totalXP or 0,
-- Define the Player table
P = {
l = 1, -- level
c = 0, -- currentXP
t = 0, -- totalXP
n = 100, -- XP for next level
g = 1.5 -- XP growth rate
}
-- Function to add XP to the player
-- Define the Player table
Player = {
level = 1,
currentXP = 0,
totalXP = 0,
xpForNextLevel = 100, -- Initial XP required for level 2
xpGrowthRate = 1.5 -- How much more XP is needed for each subsequent level
}
-- Function to add XP to the player
-- Define the Player table
Player = {
level = 1,
currentXP = 0,
totalXP = 0,
xpForNextLevel = 100, -- Initial XP required for level 2
xpGrowthRate = 1.5 -- How much more XP is needed for each subsequent level
}
-- Function to add XP to the player
@0xdevalias
0xdevalias / generating-synth-patches-with-ai.md
Last active May 18, 2024 04:38
Some notes on generating software synthesizer patches with AI
@NaCI
NaCI / fastlane_with_appcenter_actions.md
Last active May 18, 2024 04:29
Tutorial to implement App Center and Fastlane scripts to Android Project
@rebane2001
rebane2001 / plot_discord_predictions.py
Created May 18, 2024 00:18
Simple script to plot your Discord machine-learning predicted age and gender from the data dump.
"""
Simple script to plot your Discord machine-learning predicted age and gender from the data dump.
To use, simply put this script in your activity/analytics/ folder of your Discord data dump and run it.
You may need to install matplotlib first:
pip install -U matplotlib
thrown together by rebane2001
"""
@JanoPL
JanoPL / wsl2-docker-desktop-vhdx.md
Last active May 18, 2024 04:25
Move docker VHDX ext4.vhdx to new location for docker desktop in WSL 2. Move Ubuntu ext4.vhdx to new location

Docker Dekstop Data

The WSL 2 docker-desktop-data vm disk image would normally reside in: %USERPROFILE%\AppData\Local\Docker\wsl\data\ext4.vhdx

Follow the following to relocate it to other drive/directory, with all existing docker data preserved (tested against Docker Desktop 4.21.1)

First, shut down your docker desktop by right click on the Docker Desktop icon and select Quit Docker Desktop

Then, open your command prompt:

wsl --list -v

@Mahedi-61
Mahedi-61 / cuda_11.8_installation_on_Ubuntu_22.04
Last active May 18, 2024 04:23
Instructions for CUDA v11.8 and cuDNN 8.9.7 installation on Ubuntu 22.04 for PyTorch 2.1.2
#!/bin/bash
### steps ####
# Verify the system has a cuda-capable gpu
# Download and install the nvidia cuda toolkit and cudnn
# Setup environmental variables
# Verify the installation
###
### to verify your gpu is cuda enable check